<!--
 * @Author: 18222335065 2369811390@qq.com
 * @Date: 2022-10-18 14:08:12
 * @LastEditors: 18222335065 2369811390@qq.com
 * @LastEditTime: 2022-10-18 14:11:23
 * @FilePath: \hey\HeyTea_project\HeyTea-ui\src\pages\admin\log\List.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE    
-->
<template>  
  <div>
    <el-table :data="log" style="width: 100%" v-loading="loading">
      <el-table-column :index="1" type="index" label="序号" width="180">
      </el-table-column>
      <el-table-column prop="realname" label="访问者真实姓名" width="180">
      </el-table-column>
      <el-table-column prop="method" label="访问方式" width="180">
      </el-table-column>
      <el-table-column prop="content" label="访问路径"> </el-table-column>
      <el-table-column label="访问时间">
        <template slot-scope="scope">
          {{ scope.row.logTime | fmtDate1 }}
        </template>
      </el-table-column> 
    </el-table>
    <!-- 分页 -->
    <div class="page">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="params.page"
        :page-sizes="[100, 500, 800, 1000]"
        :page-size="params.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { pageQuery } from "@/api/log";
export default {
  data() {
    return {
      params: {
        page: 1,
        pageSize: 100,
      },
      loading: false,
      log: [],
      total: 0,
    };
  },
  computed: {},
  methods: {
    async getLog() {
      let res = await pageQuery(this.params);
      this.log = res.data.list;
      this.total = res.data.total;
      this.loading = false;
    },
    handleSizeChange(pageSize) {
      this.params.pageSize = pageSize;
      this.params.page = 1;
      this.getLog();
    },
    handleCurrentChange(page) {
      this.params.page = page;
      this.getLog();
    },
  },
  created() {
    this.getLog();
  },
  mounted() {},
};
</script>
<style scoped>
.page {
  text-align: right;
}
</style>